home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / COMMUNIC / H191.ZIP / CA29-3.EXE / FILEMGR.CMD < prev    next >
OS/2 REXX Batch file  |  1992-03-23  |  24KB  |  839 lines

  1.    SET TTHRU OFF        ; Make first to allow typeahead
  2.    S15 = "INTERNAL"             ; Set your word processor name here
  3. ;                ; .. "INTERNAL" -> Use COM-AND's internal editor
  4. ; ----- FileMgr: File manager shell for COM-AND
  5. ;
  6. ;    R.McG;     7/89, Chicago
  7. ;    updated: 3/92 (to use COM-AND's internal editor)
  8. ; ----------------------------------------------------------------
  9. ;    Note: You should change the second line above to specify the
  10. ;    name of the word processor you typically use.  When invoked
  11. ;    the file name to be edited is appended to the program name,
  12. ;    (e.g. equivalend to "d> PE file.txt").  If this is not appro-
  13. ;    priate, you must change the logic at the end of this script.
  14. ; ----------------------------------------------------------------
  15. ; Usages:
  16. ;    S19 -----> Legend line
  17. ;    S18 -----> Load-time drive:subdirectory (for exit)
  18. ;    S17 -----> Load-time download d:subdir (for exit)
  19. ;    S16 -----> Current file mask (for DIR function)
  20. ;    S15 -----> Editor or wordprocessor program file name
  21. ;
  22. ;    N99 -----> Number of lines on screen
  23. ;    N92 -----> Current cursor
  24. ;    N91 -----> Current cursor
  25. ;    N90 -----> Current screen highlight (1 to N99-6)
  26. ;
  27. ;    FLAG(2) -> Off if we are on left side of the display
  28. ; -----------------------------------------------------------------------
  29. ;
  30. ;    Initialization
  31. ;
  32.    CURSOR N91,N92        ; Read current cursor
  33.    S19 = "FileMgr ver 1.0     " ; 20 chars long
  34.    LEGEND S19            ; Set initial legend
  35.    SUBDIR S18            ; Read current subdir
  36.    DLDIR S17            ; Read current download subdir
  37.    SSIZE N99            ; get current screen size
  38.    SAVE 0,0,N99-2,79        ; Save original screen
  39.    ON ESCAPE GOSUB ESCAPE    ; Escape action
  40.    S16 = "*.*"                  ; Set default mask
  41. ;
  42. ;    Ask for a directory change, and then start
  43. ;
  44.    GOSUB Ask_Dir        ; Ask for a directory change
  45.    GOTO START            ; And continue
  46. ;
  47. ;    Escape - Clear all windows, and exit
  48. ;
  49. Escape:
  50.    SET DLDIR S17        ; Reset DLDIR  to load time
  51.    CHDIR S18            ; Reset default subdir to load time
  52.    RESTORE            ; Restore screen
  53.    LOCATE N91,N92        ; Restore cursor
  54.    EXIT             ; End script
  55. ;
  56. ;    Draw the screen, and decide if we're linked
  57. ;
  58. Start:
  59.    GOSUB Screen         ; Draw screen
  60.    GOSUB DispFirst        ; Build our directory list
  61.    N90 = 1            ; Set initial cursor
  62.    SET FLAG(2) OFF        ; On Left of display
  63.    GOSUB Set_Cursor        ; Set 1st cursor
  64. ;
  65. ;    We have a keypress pending
  66. ;
  67. Main:
  68.    KEYGET S1            ; Read a single key
  69.    SWITCH S1
  70.       CASE "4D00"               ; Cursor_Right
  71.      GOSUB Change_Sides
  72.       ENDCASE
  73.       CASE "4B00"               ; Cursor left
  74.      GOSUB Change_Sides
  75.       ENDCASE
  76.       CASE "4900"               ; PgUp
  77.      GOSUB Prev_Page
  78.       ENDCASE
  79.       CASE "5100"               ; PgDn
  80.      GOSUB Next_Page
  81.       ENDCASE
  82.       CASE "4700"               ; Home
  83.      GOSUB Home_Page
  84.       ENDCASE
  85.       CASE "4F00"               ; End
  86.      GOSUB End_Page
  87.       ENDCASE
  88.       CASE "4800"               ; Cursor Up
  89.      GOSUB Cursor_Up
  90.       ENDCASE
  91.       CASE "5000"               ; Cursor down
  92.      GOSUB Cursor_Down
  93.       ENDCASE
  94.       CASE "7100"               ; Alt-F10
  95.      SHELL
  96.       ENDCASE
  97.       CASE "5200"               ; INS key
  98.      GOSUB DOS
  99.       ENDCASE
  100.  
  101.       CASE "N"                  ; Change directory
  102.      GOSUB NewDir
  103.       ENDCASE
  104.       CASE "U"                  ; Upload a file
  105.      GOSUB Upld
  106.       ENDCASE
  107.       CASE "H"                  ; Help
  108.      GOSUB Help
  109.       ENDCASE
  110.       CASE "S"                  ; Send
  111.      GOSUB Send
  112.       ENDCASE
  113.       CASE "F"                  ; Free space
  114.      GOSUB Free
  115.       ENDCASE
  116.       CASE "V"                  ; View a file
  117.      GOSUB View
  118.       ENDCASE
  119.       CASE "W"                  ; Wordprocessor
  120.      GOSUB Word
  121.       ENDCASE
  122.       CASE "E"                  ; Execute a program
  123.      GOSUB EXEC
  124.       ENDCASE
  125.       CASE "C"                  ; Copy a file
  126.      GOSUB Copy
  127.       ENDCASE
  128.       CASE "D"                  ; Delete a file
  129.      GOSUB Delete
  130.       ENDCASE
  131.       CASE "R"                  ; Rename
  132.      GOSUB Rename
  133.       ENDCASE
  134.       CASE "M"                  ; New mask
  135.      GOSUB Mask
  136.       ENDCASE
  137.  
  138.       DEFAULT
  139.     SOUND 100,100        ; Signal displeasure
  140.       ENDCASE
  141.    ENDSWITCH
  142.    GOTO Main            ; And continue
  143. ;
  144. ; ----- Subroutine: Read the line at the current highlight
  145. ;    .. according to the current seting of FLAG(2)
  146. ;    S12 returns the line at the current cursor
  147. ;
  148. Read_Cursor:
  149.     S12 = ""
  150.     IF NOT ZERO N90
  151.        IF FLAG(2)        ; IF true we're on Remote
  152.           ATSCR N90,41,37 S12
  153.        ELSE
  154.           ATSCR N90, 2,37 S12
  155.           ENDIF
  156.        ENDIF
  157.     RETURN
  158. ;
  159. ; ----- Subroutine: Clear the current highlight
  160. ;    .. according to the current setting of FLAG(2)
  161. ;
  162. Clear_Cursor:
  163.     IF NOT ZERO N90
  164.        GOSUB Read_Cursor
  165.        IF FLAG(2)        ; IF true we're on remote
  166.           ATSAY N90,41 (default) S12
  167.        ELSE
  168.           ATSAY N90, 2 (default) S12
  169.           ENDIF
  170.        ENDIF
  171.     RETURN
  172. ;
  173. ; ----- Subroutine: Display the current highlight
  174. ;    .. according to the current stting of FLAG(2)
  175. ;
  176. Set_Cursor:
  177.     GOSUB Read_Cursor
  178.     IF NOT ZERO N90
  179.        IF FLAG(2)        ; IF true we're on remote
  180.           IF NOT NULL S12
  181.          ATSAY N90,41 (contrast) S12
  182.           ELSE
  183.          N90 = N90-1
  184.          GOTO Set_Cursor
  185.          ENDIF
  186.        ELSE         ; On own side
  187.           IF NOT NULL S12
  188.          ATSAY N90, 2 (contrast) S12
  189.           ELSE
  190.          N90 = N90-1
  191.          GOTO Set_Cursor
  192.          ENDIF
  193.           ENDIF
  194.        ENDIF
  195.     RETURN
  196. ;
  197. ; ----- Subroutine: Move the cursor Up
  198. ;
  199. Cursor_Up:
  200.     GOSUB Clear_Cursor
  201.     IF GT N90 1
  202.        N90 = N90-1
  203.     ELSE
  204.        N90 = N99-6
  205.        ENDIF
  206.     GOSUB Set_Cursor
  207.     RETURN
  208. ;
  209. ; ----- Subroutine: Move the cursor Down
  210. ;
  211. Cursor_Down:
  212.     GOSUB Clear_Cursor
  213.     IF LT N90 (N99-6)
  214.        N90 = N90+1
  215.     ELSE
  216.        N90 = 1
  217.        ENDIF
  218.     GOSUB Set_Cursor
  219.     RETURN
  220. ;
  221. ; ----- Subroutine: Change the display side
  222. ;
  223. Change_Sides:
  224.     GOSUB Clear_Cursor    ; Clear cursor if any
  225.     IF FLAG(2)        ; IF true we're on right
  226.        SET FLAG(2) OFF    ; .. make it left
  227.     ELSE            ; etc
  228.        SET FLAG(2) ON
  229.        ENDIF
  230.     GOSUB Set_Cursor    ; And renew cursor
  231.     RETURN
  232. ;
  233. ; ----- Subroutine: Clear a window - right or left
  234. ;    .. according to the current stting of FLAG(2)
  235. ;
  236. Clear_Window:
  237.     IF FLAG(2)        ; IF true we're on remote
  238.        SCROLL 0,1,40,(N99-6),77 (default)
  239.     ELSE
  240.        SCROLL 0,1,1,(N99-6),38 (default)
  241.        ENDIF
  242.     N90 = 0         ; Clear current cursor
  243.     RETURN
  244. ;
  245. ; ----- Subroutine: Display the previous page
  246. ;
  247. Prev_Page:
  248.     SOUND 55,500        ; Unimplemented
  249.     RETURN
  250. ;
  251. ; ----- Subroutine:  Display the next page
  252. ;
  253. Next_Page:
  254.     GOSUB DispNext        ; Display next page
  255.     N90 = 1         ; Set initial cursor
  256.     SET FLAG(2) OFF     ; On Left of display
  257.     GOSUB Set_Cursor    ; And reset cursor
  258.     RETURN
  259. ;
  260. ; ----- Subroutine:  Set to the home page
  261. ;
  262. Home_Page:
  263.     GOSUB DispFirst     ; Display first page
  264.     N90 = 1         ; Set initial cursor
  265.     SET FLAG(2) OFF     ; On Left of display
  266.     GOSUB Set_Cursor    ; And reset cursor
  267.     RETURN
  268. ;
  269. ; ----- Subroutine:  Find the ending page
  270. ;
  271. End_Page:
  272.     SOUND 55,500        ; Unimplemented
  273.     RETURN
  274. ;
  275. ; ----- Subroutine: Display first page of directory
  276. ;
  277. DispFirst:
  278.    FFIRST S16           ; Initialize
  279.    IF Failure           ; If not found
  280.       RETURN           ; Quit here
  281.       ENDIF
  282. ;
  283. ; ----- Subroutine: Display directory using current position
  284. ;    Note: Cursor is repositioned to top left
  285. ;
  286. DispNext:
  287.    N90 =  1           ; Clear current cursor
  288.    SET FLAG(2) ON       ; Clear right side
  289.    GOSUB Clear_Window       ; ..
  290.    SET FLAG(2) OFF       ; Clear left side
  291.    GOSUB Clear_Window       ; ..
  292.  
  293.    N1 = 1           ; Set loop counter
  294. ;
  295. ;    Read and display the file names
  296. ;
  297. DINE100:
  298.    FNEXT S1           ; Get next file name
  299.    IF Failure           ; If end of list
  300.       IF LE N1 1       ; If empty screen
  301.      GOTO DispFirst    ; Restart
  302.      ENDIF
  303.       RETURN           ; Else, quit
  304.       ENDIF
  305. ;
  306. ;    Skip subdirectory files
  307. ;
  308.    IF STRCMP S1(1:1) "."   ; Skip parent subdir
  309.       GOTO DINE100       ; SKip this file
  310.       ENDIF
  311. ;
  312. ;    Skip subdirectories
  313. ;
  314.    FATTR S2 S1           ; Get attribute
  315.    IF STRCMP S2(3:3) "1"   ; If a subdirectory
  316.       GOTO DINE100       ; Goto endloop
  317.       ENDIF
  318. ;
  319. ;    Get remaining information and build the display line
  320. ;
  321.    FSIZE S2 S1           ; Get file size
  322.    FDATE S3 S1           ; Get file date
  323.    FTIME S4 S1           ; Get file time
  324.    S1(13:79) = S2       ; Set size
  325.    S1(21:79) = S3       ; Set date
  326.    S1(31:79) = S4       ; Set time
  327.    S1(39) = " "            ; Make last char blank
  328. ;
  329. ;    Write the information to disc, and display the line
  330. ;
  331.    IF GE (N99-6),N1       ; If within 1st column
  332.       ATSAY N1,2 (default) S1(0:35) ; And display
  333.    ELSE
  334.       IF GE (N99-6)*2,N1   ; If within 2nd column
  335.      ATSAY (N1-(N99-6)),41 (default) S1(0:35) ; And display
  336.       ELSE
  337.      RETURN
  338.      ENDIF
  339.       ENDIF
  340.    INC N1           ; Count the line
  341.    GOTO DINE100        ; And continue
  342. ;
  343. ; ----- Subroutine: Draw the basic screen box
  344. ;
  345. Screen:
  346.    BOX     0, 0, (N99-2) ,78 (default)
  347.    ATSAY 0, 3  (default) " FileMgr "
  348.  
  349.    ATSAY N99-5,0  (default) "├─────────────────────────────────────────────────────────────────────────────┤"
  350.    ATSAY N99-4,2  (default) " , , PgUp, PgDn, Home, End, INS key (to run DOS commands), Alt-F10, H)elp"
  351.    ATSAY N99-3,2  (Default) "N)ewdir, U)pld, S)end, F)ree, V)iew, W)ord, E)xec, C)opy, D)el, R)en, M)ask"
  352.    ATSAY N99-2,28 (Default) " Press ESC to terminate "
  353.    RETURN
  354. ;
  355. ; ----- Subroutine: Help
  356. ;
  357. Help:
  358.    WOPEN  0, 0,23,78 (default) HELPESC
  359.    ATSAY  0, 2 (Default) " FileMgr "
  360.    ATSAY 23,28 (Default) " Press any key to continue "
  361. ;
  362. ;    Help message
  363. ;
  364.    ATSAY  1,2 (default) "C)opy .......... Copy the highlighted file somewhere else"
  365.    ATSAY  2,2 (default) "D)el ........... Delete the highlighted file all together "
  366.    ATSAY  3,2 (default) "E)xec .......... Run the highlighted file as a program"
  367.    ATSAY  4,2 (default) "F)ree .......... Show space left on the default drive"
  368.    ATSAY  5,2 (default) "M)ask .......... Set new search mask (default *.*)"
  369.    ATSAY  6,2 (default) "N)ewdir ........ Change directories"
  370.    ATSAY  7,2 (default) "R)en ........... Rename the highlighted file  "
  371.    ATSAY  8,2 (default) "S)end .......... Send highlighted file name through the modem"
  372.    ATSAY  9,2 (default) "U)pld .......... Upload highlighted file with protocol"
  373.    ATSAY 10,2 (default) "V)iew .......... Read the highlighted file (with DOS TYPE command)"
  374.    ATSAY 11,2 (default) "W)ord .......... Use a word processor on the highlighted file."
  375.  
  376.    ATSAY 13,2 (default) "INS key........ Run any other DOS command."
  377.    ATSAY 14,2 (default) " key ......... (Cursor down)  Move the cursor down"
  378.    ATSAY 15,2 (default) " key ......... (Cursor up)    Move the cursor up"
  379.    ATSAY 16,2 (default) "> key ......... (Cursor right) Move the cursor left"
  380.    ATSAY 17,2 (default) "< key ......... (Cursor left)  Move the cursor right"
  381.    ATSAY 18,2 (default) "PgUp key ...... Previous page of display"
  382.    ATSAY 19,2 (default) "PgDn key ...... Next page of display (circular)"
  383.    ATSAY 20,2 (default) "Home key ...... First page of display"
  384.    ATSAY 21,2 (default) "End key ....... Last page of display"
  385.    ATSAY 22,2 (default) "Alt-F10 ....... Shell to DOS (type 'EXIT' to return)"
  386. ;
  387. ;    Wait for a keypress, and return
  388. ;
  389.    KEYGET S0
  390.    WCLOSE
  391.    RETURN
  392.    ;
  393.    ;    ESCAPE during this screen
  394.    ;
  395. HELPESC:
  396.    RETURN
  397. ;
  398. ; ----- Subroutine:  Change directory
  399. ;
  400. NewDir:
  401.    GOSUB Ask_Dir       ; Try to change dir
  402.    IF SUCCESS           ; If it happened
  403.       WCLOSE           ; Close current dir window (if any)
  404.       GOSUB Screen       ; Draw screen
  405.       GOSUB DispFirst       ; Build our directory list
  406.       N90 = 1           ; Set initial cursor
  407.       SET FLAG(2) OFF       ; On Left of display
  408.       GOSUB Set_Cursor       ; Set 1st cursor
  409.       ENDIF
  410.    RETURN
  411. ;
  412. ; ----- Subroutine: Display the current subdirectory, and ask if to change
  413. ;    SUCCESS returns fact of CHDIR or no
  414. ;
  415. Ask_Dir:
  416.    WOPEN 10 10 14 70 (contrast) ASK_ESC
  417.    ATSAY 10 12 (contrast) " File Mgr NewDir "
  418.    ATSAY 11 12 (contrast) "Current subdir: "*"_SUBDIR"
  419.    ATSAY 12 12 (contrast) "Enter a new subdir, or <cr> to continue:"
  420.    ATSAY 14 30 (contrast) " Press ESC to cancel "
  421.  
  422.    ATGET 13 12 (contrast) 54 S0 ; Read new subdir
  423.    WCLOSE
  424.    ;
  425.    ;       Attempt to execute the entry
  426.    ;
  427.    IF NOT NULL S0        ; If nothing entered
  428.       CHDIR S0            ; Attempt to change
  429.       SET SUCCESS ON        ; Indicate success
  430.    ELSE
  431.       SET SUCCESS OFF
  432.       ENDIF
  433.    RETURN            ; And done
  434. ;
  435. ; ----- Escape during a subwindow
  436. ;    .. S0 is returned null
  437. ;
  438. Ask_Esc:
  439.    S0 = ""                      ; Make a null return
  440.    RETURN
  441. ;
  442. ; ----- Subroutine:  Set new mask
  443. ;
  444. Mask:
  445.    GOSUB Ask_Mask       ; Try to change dir
  446.    IF SUCCESS           ; If it happened
  447.       WCLOSE           ; Close current dir window (if any)
  448.       GOSUB Screen       ; Draw screen
  449.       GOSUB DispFirst       ; Build our directory list
  450.       N90 = 1           ; Set initial cursor
  451.       SET FLAG(2) OFF       ; On Left of display
  452.       GOSUB Set_Cursor       ; Set 1st cursor
  453.       ENDIF
  454.    RETURN
  455. ;
  456. ; ----- Subroutine: Display the current mask and ask for a change
  457. ;    SUCCESS returns fact of change
  458. ;
  459. Ask_Mask:
  460.    WOPEN 10 10 14 70 (contrast) ASK_ESC
  461.    ATSAY 10 12 (contrast) " File Mgr Mask "
  462.    ATSAY 11 12 (contrast) "Current mask: "*S16
  463.    ATSAY 12 12 (contrast) "Enter a new mask, or <cr> to continue:"
  464.    ATSAY 14 30 (contrast) " Press ESC to cancel "
  465.  
  466.    ATGET 13 12 (contrast) 54 S0 ; Read new mask
  467.    WCLOSE
  468.    ;
  469.    ;       Attempt to execute the entry
  470.    ;
  471.    IF NOT NULL S0        ; If nothing entered
  472.       S16 = S0            ; Attempt to change
  473.       SET SUCCESS ON        ; Indicate success
  474.    ELSE
  475.       SET SUCCESS OFF
  476.       ENDIF
  477.    RETURN            ; And done
  478. ;
  479. ; ----- Subroutine: Rename a file
  480. ;
  481. Rename:
  482.    GOSUB Ask_Rename       ; Try to change dir
  483.    IF SUCCESS           ; If it happened
  484.       RENAME S12 S0       ; Attempt to change
  485.       IF SUCCESS       ; Indicate success
  486.      IF FLAG(2)       ; IF true we're on remote
  487.         ATSAY N90,41 (contrast) S0(0:10)
  488.      ELSE           ; On own side
  489.         ATSAY N90, 2 (contrast) S0(0:10)
  490.         ENDIF
  491.       ELSE
  492.      S0 = "Rename to "*S0&" failed"
  493.      GOSUB Error
  494.      SET SUCCESS OFF
  495.      ENDIF
  496.       ENDIF
  497.    RETURN
  498. ;
  499. ; ----- Subroutine: Fatal error.  Open a window, and display a message
  500. ;    S0 passes the error message(s)
  501. ;
  502. Error:
  503.    WOPEN 10,10,12,70 (contrast) Err_Esc
  504.    ATSAY 10,12 (contrast) " File Mgr Error "
  505.    ATSAY 11,12 (contrast) S0(0:55); Max msg width 55 chars
  506.    ATSAY 12,26 (contrast) " Press any key to continue "
  507.    ;
  508.    ;    Wait a keypress
  509.    ;
  510.    KEYGET S0               ; Wait for any key
  511.    WCLOSE
  512.    RETURN
  513.    ;
  514.    ;    Escape during this screen
  515.    ;
  516. Err_Esc:
  517.    RETURN
  518. ;
  519. ; ----- Subroutine: Ask for a file's new name
  520. ;    SUCCESS returns fact of change
  521. ;    S12 returns the file name
  522. ;
  523. Ask_Rename:
  524.    GOSUB Read_Cursor        ; S12 returns current highlight
  525.    S12 = S12(0:11)&""           ; Reduce to fname and trim trailing spaces
  526.    WOPEN 10 10 14 70 (contrast) ASK_ESC
  527.    ATSAY 10 12 (contrast) " File Mgr Rename "
  528.    ATSAY 11 12 (contrast) "Current file: "*S12
  529.    ATSAY 12 12 (contrast) "Enter a new name, or <cr> to continue:"
  530.    ATSAY 14 30 (contrast) " Press ESC to cancel "
  531.  
  532.    ATGET 13 12 (contrast) 11 S0 ; Read new fname
  533.    WCLOSE
  534.    ;
  535.    ;       Test the response
  536.    ;
  537.    LJ S0            ; Left justify
  538.    S0 = S0&""                   ; Trim trailing spaces
  539.    IF NOT NULL S0        ; If nothing entered
  540.       SET SUCCESS ON
  541.    ELSE
  542.       SET SUCCESS OFF
  543.       ENDIF
  544.    RETURN            ; And done
  545. ;
  546. ; ----- Subroutine: Delete a file
  547. ;
  548. Delete:
  549.    GOSUB Ask_Delete       ; Ask for y/n
  550.    IF SUCCESS           ; If yes
  551.       DELETE S12       ; Attempt to change
  552.       IF SUCCESS       ; Indicate success
  553.      IF FLAG(2)       ; IF true we're on remote
  554.         ATSAY N90,41 (contrast) "<deleted>                            "
  555.      ELSE           ; On own side
  556.         ATSAY N90, 2 (contrast) "<deleted>                            "
  557.         ENDIF
  558.       ELSE
  559.      S0 = "Delete of "*S12&" failed"
  560.      GOSUB Error
  561.      SET SUCCESS OFF
  562.      ENDIF
  563.       ENDIF
  564.    RETURN
  565. ;
  566. ; ----- Subroutine: Ask if a file is to be really and truely deleted
  567. ;    SUCCESS returns fact of y/n
  568. ;    S12 returns the file name
  569. ;
  570. Ask_Delete:
  571.    GOSUB Read_Cursor        ; S12 returns current highlight
  572.    S12 = S12(0:11)&""           ; Reduce to fname and trim trailing spaces
  573.    WOPEN 10 10 14 70 (contrast) ASK_ESC
  574.    ATSAY 10 12 (contrast) " File Mgr Delete "
  575.    ATSAY 11 12 (contrast) "Current file: "*S12
  576.    ATSAY 12 12 (contrast) "Do you wish to delete the file Y/N (cr = N)?:"
  577.    ATSAY 14 30 (contrast) " Press ESC to cancel "
  578.  
  579.    ATGET 13 12 (contrast) 1 S0 ; Read y/n
  580.    WCLOSE
  581.    ;
  582.    ;       Interperet the response
  583.    ;
  584.    IF FIND S0 "Y"               ; If yes
  585.       SET SUCCESS ON
  586.    ELSE
  587.       SET SUCCESS OFF
  588.       ENDIF
  589.    RETURN            ; And done
  590. ;
  591. ; ----- Subroutine: Send file name out the comm port
  592. ;
  593. Send:
  594.    GOSUB Read_Cursor        ; S12 returns current highlight
  595.    S12 = S12(0:11)&""           ; Reduce to fname and trim trailing spaces
  596.    WOPEN 10 10 14 70 (contrast) ASK_ESC
  597.    ATSAY 10 12 (contrast) " File Mgr Send "
  598.    ATSAY 11 12 (contrast) "Current file: "*S12
  599.    ATSAY 12 12 (contrast) "Do you wish send this file name Y/N (cr = N)?:"
  600.    ATSAY 14 30 (contrast) " Press ESC to cancel "
  601.  
  602.    ATGET 13 12 (contrast) 1 S0 ; Read y/n
  603.    WCLOSE
  604.    ;
  605.    ;       Interperet the response
  606.    ;
  607.    IF FIND S0 "Y"               ; If yes
  608.       PRESERVE S12        ; Make sendable
  609.       TRANSMIT S12*"!"          ; Xmit w/c/r
  610.       ENDIF
  611.    RETURN            ; And done
  612. ;
  613. ; ----- Subroutine: Free space report
  614. ;
  615. Free:
  616.    FREE S0 ""                   ; Use default drive
  617.    LJ S0            ; .. left justify
  618.    WOPEN 10,10,13,70 (contrast) Free_Esc
  619.    ATSAY 10,12 (contrast) " File Mgr Free  "
  620.    ATSAY 11,12 (contrast) "Current subdir: "*"_SUBDIR"
  621.    ATSAY 12,12 (contrast) "Free space is:  "*S0
  622.    ATSAY 13,26 (contrast) " Press any key to continue "
  623.    ;
  624.    ;    Wait a keypress
  625.    ;
  626.    KEYGET S0            ; Wait for any key
  627.    WCLOSE
  628.    RETURN
  629.    ;
  630.    ;    ESCAPE during this screen
  631.    ;
  632. Free_Esc:
  633.    RETURN
  634. ;
  635. ; ----- Subroutine:  Execute a DOS command
  636. ;
  637. DOS:
  638.    GOSUB Ask_Cmd        ; Ask for command
  639.    IF SUCCESS            ; If non-null string rtnd
  640.       DOS S0            ; Attempt to execute it
  641.       ENDIF
  642.    RETURN
  643. ;
  644. ; ----- Subroutine: Ask for a DOS command
  645. ;    SUCCESS returns fact of a nonnull string in S0
  646. ;
  647. Ask_Cmd:
  648.    WOPEN 10  0 13 78 (contrast) ASK_ESC
  649.    ATSAY 10  2 (contrast) " File Mgr DOS "
  650.    ATSAY 11  2 (contrast) "Enter a DOS command:"
  651.    ATSAY 13 21 (contrast) " Press ESC to cancel "
  652.  
  653.    ATGET 12  2 (contrast) 72 S0 ; Read new mask
  654.    WCLOSE
  655.    ;
  656.    ;       Interpret the response
  657.    ;
  658.    IF NOT NULL S0        ; If nothing entered
  659.       SET SUCCESS ON        ; Indicate success
  660.    ELSE
  661.       SET SUCCESS OFF
  662.       ENDIF
  663.    RETURN            ; And done
  664. ;
  665. ; ----- Subroutine:  Copy current file
  666. ;
  667. Copy:
  668.    GOSUB Ask_Copy       ; Ask for target
  669.    IF SUCCESS           ; If yes
  670.       DOS "COPY "*S12*" "*S0
  671.       IF FAILED        ; If failure returned
  672.      S0 = "Copy of "*S12&" failed"
  673.      GOSUB Error
  674.      ENDIF
  675.       ENDIF
  676.    RETURN
  677. ;
  678. ; ----- Subroutine: Ask for the target of a copy
  679. ;    SUCCESS returns fact of change
  680. ;    S12 returns the from file name, S0 returns the 'to'
  681. ;
  682. Ask_Copy:
  683.    GOSUB Read_Cursor        ; S12 returns current highlight
  684.    S12 = S12(0:11)&""           ; Reduce to fname and trim trailing spaces
  685.    WOPEN 10 10 14 70 (contrast) ASK_ESC
  686.    ATSAY 10 12 (contrast) " File Mgr Copy "
  687.    ATSAY 11 12 (contrast) "Current file: "*S12
  688.    ATSAY 12 12 (contrast) "Enter the destination of the copy (or CR to continue):"
  689.    ATSAY 14 30 (contrast) " Press ESC to cancel "
  690.  
  691.    ATGET 13 12 (contrast) 54 S0 ; Read new fname
  692.    WCLOSE
  693.    ;
  694.    ;       Test the response
  695.    ;
  696.    LJ S0            ; Left justify
  697.    S0 = S0&""                   ; Trim trailing spaces
  698.    IF NOT NULL S0        ; If nothing entered
  699.       SET SUCCESS ON
  700.    ELSE
  701.       SET SUCCESS OFF
  702.       ENDIF
  703.    RETURN            ; And done
  704. ;
  705. ; ----- Subroutine:  Execute a program
  706. ;
  707. Exec:
  708.    GOSUB Read_Cursor        ; S12 returns current highlight
  709.    S12 = S12(0:11)&""           ; Reduce to fname and trim trailing spaces
  710.    IF FIND S12 ".BAT"           ; Look for a batch file
  711.       DOS S12
  712.    ELSE
  713.       IF (FIND S12 ".EXE" or FIND S12 ".COM")
  714.      SAVE 0,0,N99-2,79    ; Save current screen
  715.      RUN S12
  716.      RESTORE        ; Restore screen
  717.       ELSE
  718.      S0 = "Target file is not a BATch file or a program (COM or EXE)"
  719.      GOSUB Error
  720.      ENDIF
  721.       ENDIF
  722.    RETURN            ; And done
  723. ;
  724. ; ----- Subroutine:  View a file
  725. ;
  726. View:
  727.    GOSUB Read_Cursor        ; S12 returns current highlight
  728.    S12 = S12(0:11)&""           ; Reduce to fname and trim trailing spaces
  729.    IF NOT NULL S12
  730.       SAVE  0,0 N99-2,79
  731.       CLEAR (text)
  732.       LOCATE 0,0
  733.       TYPE S12
  734.       RESTORE
  735.       ENDIF
  736.    RETURN            ; And done
  737. ;
  738. ; ----- Subroutine:  Upload current file
  739. ;
  740. UpLd:
  741.    GOSUB Ask_Upld
  742.    SWITCH S0
  743.       CASE "_NULL"              ; No entry
  744.       ENDCASE            ; .. no action
  745.       CASE "1"                  ; WXMODEM
  746.      SENDFILE WXMODEM S12
  747.       ENDCASE
  748.       CASE "2"                  ; XMODEM
  749.      SENDFILE XMODEM S12
  750.       ENDCASE
  751.       CASE "3"                  ; ASCII
  752.      SENDFILE ASCII S12
  753.       ENDCASE
  754.       CASE "4"                  ; YMODEM/XMODEM1K
  755.      SENDFILE YMODEM S12
  756.       ENDCASE
  757.       CASE "5"                  ; CISB
  758.      SENDFILE CISB S12
  759.       ENDCASE
  760.       CASE "6"                  ; QuickB
  761.      SENDFILE QuickB  S12
  762.       ENDCASE
  763.       CASE "7"                  ; KERMIT
  764.      SENDFILE KERMIT S12
  765.       ENDCASE
  766.       CASE "8"                  ; Batch YMODEM
  767.      SENDFILE BYMODEM S12
  768.       ENDCASE
  769.       CASE "9"                  ; Batch YMODEM-G
  770.      SENDFILE BYMOG S12
  771.       ENDCASE
  772.  
  773.       DEFAULT
  774.     SOUND 100,100        ; Signal displeasure
  775.       ENDCASE
  776.    ENDSWITCH
  777.    RETURN
  778. ;
  779. ; ----- Subroutine: Ask for the upload method
  780. ;    S0 returns the selected method # (1-9) or null
  781. ;    S12 returns the from file name
  782. ;
  783. Ask_Upld:
  784.    GOSUB Read_Cursor        ; S12 returns current highlight
  785.    S12 = S12(0:11)&""           ; Reduce to fname and trim trailing spaces
  786.    WOPEN  2 20 16 60 (contrast) ASK_ESC
  787.    ATSAY  2 22 (contrast) " File Mgr UpLd "
  788.    ATSAY  3 22 (contrast) "Current file: "*S12
  789.    ATSAY  4 20 (contrast)  "├───────────────────────────────────────┤"
  790.    ATSAY  5 22 (contrast) " 1) Windowed XMODEM"
  791.    ATSAY  6 22 (contrast) " 2) CRC/Checksum XMODEM"
  792.    ATSAY  7 22 (contrast) " 3) ASCII transfer "
  793.    ATSAY  8 22 (contrast) " 4) YMODEM/XMODEM-1K"
  794.    ATSAY  9 22 (contrast) " 5) CIS-B          "
  795.    ATSAY 10 22 (contrast) " 6) CIS Quick-B    "
  796.    ATSAY 11 22 (contrast) " 7) Kermit         "
  797.    ATSAY 12 22 (contrast) " 8) Batch YMODEM   "
  798.    ATSAY 13 22 (contrast) " 9) Batch YMODEM-G "
  799.    ATSAY 14 20 (contrast)  "├───────────────────────────────────────┤"
  800.    ATSAY 15 22 (contrast) "Enter method #:"
  801.    ATSAY 16 30 (contrast) " Press ESC to cancel "
  802.  
  803.    ATGET 15 48 (contrast) 1 S0 ; Read new fname
  804.    WCLOSE
  805.    RETURN            ; And done
  806. ;
  807. ; ----- Subroutine:  Invoke a word processor
  808. ;
  809. Word:
  810.    IF NOT NULL S17 GOTO WORD100 ; Only ask once
  811. ;
  812. ;    Open a window and ask for the WORDor's name
  813. ;
  814.    WOPEN 10,1  13,78 (default) Ask_Esc
  815.    ATSAY 10,3  (default) " FileMgr Word "
  816.    ATSAY 11,3  (default) "Enter the editor's name, fully qualified (e.g. C:\PE.EXE)."
  817.    ATSAY 12,3  (default) "-> "
  818.    ATSAY 13,30 (default) " Press ESC to cancel "
  819.    ATGET 12,6  (default) 50 S0    ; Ask_Esc clears S0, so we use it
  820.    WCLOSE
  821.  
  822.    IF NULL S0 RETURN        ; Return on empty answer
  823.    S15 = S0
  824. ;
  825. ;    Get the file name
  826. ;
  827. WORD100:
  828.    GOSUB Read_Cursor        ; S12 returns current highlight
  829.    S12 = S12(0:11)&""           ; Reduce to fname and trim trailing spaces
  830. ;
  831. ;    If not a null file name, perform the request
  832. ;
  833.    IF NOT NULL S12 and (NOT NULL S15 and NOT FIND S15 "INTERNAL")
  834.       RUN S15 * " " *S12        ; Make upper case
  835.       IF FAILED S15 = "INTERNAL"; Switch to internal editor
  836.       ENDIF
  837.    IF (NULL S15 or FIND S15 "INTERNAL") and NOT NULL S12 EDIT S12
  838.    RETURN
  839.